<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery.min.js"></script>
    <script>
        $(function () {
            $("#btn").click(function () {
                $.ajax({
                    url: "user/testAjax",
                    contentType: "application/json;charset=UTF-8",
                    data: '{"username":"qqww","age":20}',
                    dataType: "json",
                    type: "post",
                    success: function (data) {
                        alert(data);
                        alert(data.username);
                        alert(data.age);
                    }
                });
            });
        });
    </script>
</head>
<body>
<%--<a href="user/testReturnString">返回值类型为String</a>--%>
<input type="button" id="btn" value="发送ajax请求">
</body>
</html>
